﻿using System;
using Animoso.Domain;
using Animoso.Domain.Data;
using NHibernate;
using NHibernate.Criterion;

namespace Animoso.Data
{
    public class PageRepository : BaseRepository<Page>, IPageRepository
    {
        public Page GetByTitle(string title)
        {
            using (ISession session = SessionProvider.GetSession())
            {
                Page content = session.CreateCriteria(typeof(Page))
                   .Add(Expression.Eq("Title", title))
                   .UniqueResult<Page>();

                return content;
            }
        }
    }
}